<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<%@ page contentType="text/html; charset=utf-8"%>
	<%@ include file="/commons/taglibs.jsp"%>

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
		<title>我的审核列表</title>

		<%@ include file="/commons/css_js_head.jsp"%>


		<script type="text/javascript">
//复写Url
doApplyUrl = "${ctx }/base/typeAuditAction!doApply.ts"
doListUrl = "${ctx }/base/typeAuditAction!doList.ts"
//进行审核
function doApply(pkId,status1) {

	var _form = document.forms[0];
	if (doApplyUrl == '') {
		alert('请设置正确的URL!');
		return false;
	}
	_form.action = doApplyUrl + "?theId=" + pkId+"&status1="+status1;
	_form.submit();
}

  //选取所有的checkbox控件
  checkit  =  true;      
  function   SelectAll()  {
   var checkbox = document.getElementsByName("checkbox");      
      if (checkit)      
      {      
      for(i=0;i<checkbox.length;i++)
      
        checkbox.item(i).checked=true;   
        checkit = false;      
      }      
      else      
      {      
      for(i=0;i<checkbox.length;i++)      
        checkbox.item(i).checked=false;      
        checkit = true;      
      }      
}

//批量审核
function   doApplyAll(status1) 
{ 
	var nid="";
    var checkbox   =   document.getElementsByName( "checkbox");
    
	a = new Array(checkbox.length);
	b = new Array(checkbox.length);
    for   (var   i=0;   i < checkbox.length;   i++) 
    { 
	   
        if (checkbox[i].checked)
		{
		  var value = checkbox[i].value.split("-");
		  a[i] = value[0];//value[0]表示Id
		  b[i] = value[1];//value[1]表示状态
		  //判断，只有未审核的才可以进行批量操作
		  
		 
		  nid=nid+(checkbox[i].value)+",";
		  
		  
		// if(b[i] == 0){
		// 	alert("选中的项中，存在已审核通过的项");
		// 	return ;
		// }else if(b[i] == 2){
		 //	alert("选中的项中，存在已审核不通过的项");
		 //	return ;
		// }else if(b[i] == 3){
		//  	alert("选中的项中，存在取消的项");
		//  	return ;
		//}
		
			if(b[i] != 1){
				alert("有的项已经审核了，请选择未审核的！");
				return ;
			}
    	} 
   
	}
	if(nid==""){
		alert("请选择终端类型！");
		return false;
	}else{
		doApply(a,status1);
	}
	
} 

</script>


	</head>
	<body style="overflow-x: hidden">

		<!-- 标题 -->
		<div class="mTitle">
			<span class="hidsearch"><a href="javascript:void(0)"
				onClick="return chg('searchList');" id="ImgArrow"> <img
						src="${ctx}/images/icon_up.gif" id="imgButton" />
			</a> </span>
			<b class="bbig">信息终端类型申请审核列表</b>
			
		</div>

		<!--list -->
		<div class="searchBar" id="searchList" style="display: block;">
			<form action="${ctx}/base/typeAuditAction!doList.ts" method="post">
				<table class="searchTable">
					<tr>
						<th>
							审核状态：
						</th>
						
						<td>
							<s:select list="#{1:'未审核',0:'审核通过',2:'审核不通过',3:'取消'}"
							theme="simple"
                            name="status" 
						    cssStyle="width:100px;"
							listKey="key" 
							listValue="value"  
							headerKey="1"
							>
							
							</s:select>
						</td>
						<td>
							<input name="btn_query" type="button" class="btn" value="查询"
								onclick="doQuery()" />
							
						</td>
					</tr>
				</table>
			</form>
		</div>
		<div class="mainList">

			<table class="listTable">
				<tr>
					<th>序号</th>
					<th> <input type="checkbox" name="all" onclick="SelectAll()"/>批量操作</th>
					<th>
						申请人公司名称
					</th>
					<th>
						终端类型
					</th>
					
					
					<th>
						应用平台名称
					</th>
					<th>
						状态
					</th>
					<th>
						操作
					</th>
				</tr>
				<c:forEach var="typeAudit" varStatus="status" items="${pager.data}">
					<tr align=center>
						<td>
							${status.index+1 }
						</td>
						<td><input type="checkbox" name="checkbox" id="cehckBox" value="${typeAudit.theId }-${typeAudit.status}" /> </td>
						<td>
							${typeAudit.startUserName}
						</td>
						<td>
							${typeAudit.theIdmachine}
						</td>
						
						
						<td>
							${typeAudit.theIdapply}
						</td>
						<td>
						<c:if test="${typeAudit.status == '1'}"> 未审核 </c:if>
						<c:if test="${typeAudit.status == '0' }">审核通过</c:if>
						<c:if test="${typeAudit.status == '2'}">审核不通过</c:if>
						<c:if test="${typeAudit.status == '3'}">取消</c:if>
						</td>
						
						<td>
						<c:if test="${typeAudit.status == '1'}">
							<a href="javascript:void(0)" onclick="javascript:doApply('${typeAudit.theId },','0');"><span class="icon_add">&nbsp;</span>审核通过</a>
							<a href="javascript:void(0)" onclick="javascript:doApply('${typeAudit.theId },','2');"><span class="icon_edit">&nbsp;</span>审核不通过</a>
						</c:if>
						<c:if test="${typeAudit.status == '0' or typeAudit.status == '2'}">
							<a href="javascript:void(0)" onclick="javascript:doApply('${typeAudit.theId },','3');"><span class="icon_del">&nbsp;</span>取消审核</a>
						</c:if>
						</td>
					</tr>
					</c:forEach>
			</table>
		</div>
		<!--end list -->
        <a href="javascript:void(0)" onclick="javascript:doApplyAll('0');"><span class="icon_add">&nbsp;</span>批量审核通过</a>
		<a href="javascript:void(0)" onclick="javascript:doApplyAll('2');"><span class="icon_edit">&nbsp;</span>批量审核不通过</a>
		<!-- 分页区域  -->
<%@ include file="/page/pager.jsp"%>

<script type="text/javascript">
ajaxAnywhere.formName = "form1";
ajaxAnywhere.getZonesToReload = function() {
    return "zoneList";
}
</script>

	</body>
</html>
